var fs = require('fs');
var logicBasic = require("./flopMachineLogic.js")
var logic = new logicBasic()

logic.shuffle()
logic.sendCard(0)
// console.log("begin : ",logic.handCards)
var handCards = [ 
  { num: 10, type: 1},
  { num: 14, type: 1},
  { num: 3, type: 0},
  { num: 5, type: 2},
  { num: 5, type: 1}
 ]
var hold = logic.holdCards(handCards)
console.log("hold",hold)
console.log(logic.holdCardsType(hold))

// console.log("end : ",logic.handCards,logic.getCardType(logic.handCards))
// var handCard = [{"num":12,"type":2,"index":2},{"num":12,"type":1,"index":29},{"num":2,"type":3,"index":7},{"num":6,"type":0,"index":8},{"num":6,"type":0,"index":52}]
// // logic.sendCard()
// // logic.handCards = handCard
// // logic.changeCards([0,2])
// var result = logic.getCardType(handCard)
// console.log("result",result)
// var allCount = 0
// var counts = {
//     "1" : 0,
//     "2" : 0,
//     "3" : 0,
//     "4" : 0,
//     "5" : 0,
//     "6" : 0,
//     "7" : 0,
//     "8" : 0,
//     "9" : 0,
//     "10" : 0,
//     "11" : 0
// }
// var prob = {}
// var time1 = (new Date()).getTime()
// var jsonCfg = {}
// for(var i = 0;i < logic.cards.length - 4;i++){
// 	for(var j = i + 1;j < logic.cards.length - 3;j++){
// 		for(var k = j + 1;k < logic.cards.length - 2;k++){
// 			for(var z = k + 1;z < logic.cards.length - 1;z++){
// 				for(var n = z + 1;n < logic.cards.length;n++){
// 					var handCard = []
// 					handCard.push(logic.cards[i])
// 					handCard.push(logic.cards[j])
// 					handCard.push(logic.cards[k])
// 					handCard.push(logic.cards[z])
// 					handCard.push(logic.cards[n])
// 					var str = ""
// 					for(var m = 0;m < handCard.length;m++){
// 						str += handCard[m].index
// 					}
// 					var result = logic.getCardType(handCard)
// 					// if(jsonCfg[str]){
// 					// 	console.log("error : ",str,jsonCfg[str],i,j,k,z,n)
// 					// }
// 					allCount++
// 					counts[result.type]++
// 					// jsonCfg[str] = result.type
// 				}
// 			}
// 		}
// 	}
// }
// var dt = (new Date()).getTime() - time1
// console.log("dt",dt)
// console.log("allCount",allCount)
// console.log("counts",counts)
// for(var i in counts){
// 	prob[i] =  (counts[i] / allCount).toFixed(6)
// }
// console.log("prob",prob)
// var filename = "c:\\jsonCfg.json";
// fs.writeFileSync(filename, JSON.stringify(jsonCfg));